<?php

class department_Form_FrmDpt extends Zend_Form
{

	public function init()
    {
        /* Form Elements & Other Definitions Here ... */
    	$this->setMethod('post');
    }
    function fromdpt($dptfrom = null){
    	$request=Zend_Controller_Front::getInstance()->getRequest();
		$db = new Application_Model_DbTable_DbGlobal();
		$sql = "Select fac_id,fac_name From tbl_faculty";
		$rows= $db->getGlobalDb($sql);
		//print_r($rows);exit();
		$options = array("" =>"- - - Select Type of Faculty - - -");	
		foreach($rows as $read) $options[$read['fac_id']]= $read['fac_name'];
		$fac = new Zend_Form_Element_Select('fac_id');
		$fac->setMultiOptions($options);
		$fac->setAttribs(array('fac_id'=>'fac_name','class'=>'form-control'));
				
    	$dpt = new Zend_Form_Element_Text("dpt_name");
    		$dpt->setAttribs(array("class"=>"form-control validate[required]"));
    	$description = new Zend_Form_Element_Textarea("description");
    		$description->setAttribs(array("class"=>"form-textarea validate[required]"));	
    	$ordering = new Zend_Form_Element_Text("ordering");
    		$ordering->setAttribs(array("class"=>"form-control validate[required]"));
    		$id = new Zend_Form_Element_Hidden("dpt_id");
    	$this->addElements( array($fac,$dpt,$description,$ordering,$id));    	
    	if($dptfrom !=""){    	
    		$id->setValue($dptfrom['dpt_id']);
    		$fac->setValue($dptfrom['fac_id']);
    		$dpt->setValue($dptfrom['dpt_name']);
    		$description->setValue($dptfrom['description']);
    		$ordering->setValue($dptfrom['ordering']);
    	}
    	return $this;
    }
}
    	